/**
 * Select
 */
define('pc/js/components/VueArticleList/vue-article-list', [
    'utils/helpers',
    'utils/Time',
    'pc/js/components/VueArticleList/list.css'
], function(helpers, Time){

const VueArticleList = {
    props: {
        list: {default: null}
    },
    methods: {
        makeUrl: function(id) {
            return helpers.U('posts', {id: id}, '.html');
        },
        formatTime: function(time) {
            return Time.format('m/d h点', time);
        }
    },
    template:
`
<ul v-if="null !== list" class="vue-generallist-wrapper">
    <li class="vue-generallist-item" v-for="item in list">
        <div class="vue-generallist-item-img-wrapper">
            <a class="vue-generallist-item-img" v-bind:href="makeUrl(item.id)" v-bind:style="{backgroundImage: 'url('+ item.thumb +')'}"></a>
        </div>
        <h3 class="vue-generallist-item-title">
            <a target="_blank" v-bind:href="makeUrl(item.id)">{{ item.title }}</a>
        </h3>
        <div class="vue-generallist-item-footer">
            <span class="x-pullright">{{ formatTime(item.post_time * 1000) }}</span>
        </div>
    </li>
</ul>
`
};
return VueArticleList;
});


